const baseUrl = 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1'

export async function getCurrencyList() {
  try {
    const response = await fetch(
      `${baseUrl}/currencies.json`
    );
    const data = await response.json();
    console.log(data);
    return data;
  } catch (error) {
    console.log(error.message);
  }
}
export async function getCurrencyRate(from , to ,amount) {
    try {
        const response = await fetch(
            `${baseUrl}/currencies/${from}.json`
          );
          const data = await response.json();
          console.log(data);
          return data[from][to] * amount
    } catch (error) {
        console.log(error.message);
    }


}

